import copy

class Solution(object):
    def subsets(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        result = [[]]
        def traverse(sub, begin):
            for i in range(begin, len(nums)):
                sub.append(nums[i])
                result.append(copy.copy(sub))
                traverse(sub, i+1)
                sub.pop()
        traverse([], 0)
        return result

print(Solution().subsets([1,2,3]))